class item
{
public:
    item(int x = 0) { val = x; }
    int val;
};

class decorator
{
public:
    item *myItem;
    void addVal(int x)
    {
        if (myItem == nullptr)
            return;
        myItem->val += x;
    }
};

int main()
{
    decorator dec;
    item *tmp = new item(114514);
    dec.myItem = tmp;
    dec.addVal(1919810);
}